<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2018-05-31
  Time: 16:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加挂号</title>
    <%@ include file="../statics/AllJavaScript.jsp" %>
    <script type="text/javascript" src="${pageContext.request.contextPath}/statics/date/Moment.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/statics/date/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/statics/treeview/bootstrap-treeview.min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/date/bootstrap-datetimepicker.min.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/treeview/bootstrap-treeview.min.css"/>
</head>
<body>
<div style="width:1200px; margin:180px;">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">添加挂号信息</h3>
        </div>
        <div class="panel-body">
            <form action="${pageContext.request.contextPath}/register/AddRegister" method="post">
                <div class="form-inline">
                    姓名:<input id="pName" name="pName" type="text" lang="zh-CN" class="form-control" placeholder="请输入姓名"
                              style="width:200px; margin-right: 100px"/>
                    性别:
                    <select name="pSex" style="width:50px; height:30px;border-radius:10px; border-color: #ccc; margin-right: 100px">
                        <option value="男">男</option>
                        <option value="女">女</option>
                    </select>
                    身份证号：<input id="pCards" name="pCards" type="text" lang="zh-CN" class="form-control"
                                placeholder="请输入身份证号" style="width:500px;"/>
                </div>
                <div class="form-inline" style="margin-top: 20px">
                    邮箱: <input id="email" name="pEmal" type="text" lang="zh-CN" class="form-control" placeholder="请输入邮箱"
                               style="width:400px;"/>
                </div>
                <div class="form-inline" style="margin-top: 20px; width:300px;">
                    出生日期:
                    <div class="input-group input-daterange">
                        <input id="pBirthDate" name="pBirthDate" type="text" class="form-control"/>
                    </div>
                </div>
                <div class="form-inline" style="margin-top: 20px; width:300px;">
                    电话:<input id="phone" name="pPhone" type="text" class="form-control"/>
                </div>
                <div class="form-inline" style="margin-top: 20px; width:300px;">
                    挂号费:<input id="Register_balance" name="Register_balance" type="text" class="form-control"
                               readonly="readonly" value="15"/>元
                </div>
                <div class="form-inline" style="margin-top: 20px; width:300px;">
                    充值金额:<input id="balance" name="rBalance" type="text" class="form-control"/>
                </div>
                <input type="text" style="display: none;" name="pdId" id="pdId">
                <div class="form-inline" style="margin-top: 20px; width:300px;">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    $('#BirthDate').datetimepicker({
        format: 'YYYY-MM-DD',
        maxDate: (new Date())
    });
    $("#pName").bind("change",function () {
        var sex=$("#pSex");
        var pname= $("#pName");
        var code= $("#pCards");
        var BirthDate= $("#pBirthDate");
        var phone= $("#phone");
        var email=$("#email");
        var pdid=$("#pdId");
        $.ajax({
            url:"${pageContext.request.contextPath}/register/AddQueryPatient",
            data:{"pName":$(this).val(),"query":"queryPname"},
            datatype:"json",
            method:"post",
            "success":function (data) {
                if (data!=null &&data!="" && data!="null"){
                   pname.val(data.pName);
                    sex.val(data.pSex);
                    code.val(data.pCards);
                    BirthDate.val(data.pBirthDate);
                    phone.val(data.pPhone);
                    email.val(data.pEmal);
                    pdid.val(data.pId);
                }else{
                    sex.val("");
                    code.val("");
                    BirthDate.val("");
                    phone.val("");
                    email.val("");
                    pdid.val("null");
                }
            }
        })
    })

</script>
</html>
